package cn.gameback.supervisionservices.Controller;

import cn.gameback.supervisionservices.entity.Course;
import cn.gameback.supervisionservices.service.CourseService;
import cn.gameback.supervisionservices.vo.RequestVo.CourseVo.CourseQuery;
import cn.gameback.supervisionservices.vo.RequestVo.UserVo.UserQuery;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/course")
public class CourseController {

    @Autowired
    private CourseService courseService;

    //Post
    @PostMapping("/")
    public ResponseEntity<?> getCourseData (@RequestBody CourseQuery courseQueryRequest) {
        Page<Course> paging = new Page<>(courseQueryRequest.getCurrent(),courseQueryRequest.getPageSize());

        IPage<Course> coursePage = courseService.getAllCourse(courseQueryRequest);
        return ResponseEntity.ok(coursePage);
    }

}
